<!-- Botões -->
<div class="row-fluid" id="divPrint">
    <?php
    if ($this->data[0]->getSqSituacaoTurma()->getSqSituacaoTurma() == Sisesporte\Constant\TipoSituacaoTurmaConstant::A_SER_SORTEADA):
        ?>
        <div class="span2 action-btn round-all">
            <a href="#" title="Sortear">
                <div><i class="icon-gift"></i></div>
                <div><strong>Sortear</strong></div>
            </a>
        </div>
        <?php
    endif;
    ?>
    <div class="span2 action-btn round-all">
        <a href="<?php echo $this->url('sisesporte-admin', array('controller' => 'sorteio')) ?>" title="Consultar">
            <div><i class="icon-th-list"></i></div>
            <div><strong>Consultar</strong></div>
        </a>
    </div>
</div>
<!-- Fim Botões -->
<div class="row-fluid">
    <div class="span12 column" id="col0">
        <div class="box">
            <h4 class="box-header round-top">Efetivar Sorteio</h4>
            <div class="box-container-toggle">
                <div class="box-content">
                    <div class="row-fluid">
                        <div class="span12">
                            <div class="span3">
                                <div class="controls controls-rows">
                                    <label class="control-label"><strong>Turma:</strong> <?php echo $this->data[0]->getCoTurma() ?></label>
                                </div>
                            </div>
                            <div class="span3">
                                <div class="controls controls-rows">
                                    <label class="control-label"><strong>Horário:</strong> <?php echo $this->data[0]->getSqHorarioInicio()->getNoHorario() . " às " . $this->data[0]->getSqHorarioTermino()->getNoHorario() ?></label>
                                </div>
                            </div>
                            <div class="span3">
                                <div class="controls controls-rows">
                                    <label class="control-label"><strong>Nível:</strong> <?php echo $this->data[0]->getSqNivel()->getNoNivel(); ?></label>
                                </div>
                            </div>
                            <div class="span3">
                                <div class="controls controls-rows">
                                    <label class="control-label"><strong>Nº de Vagas:</strong> <?php echo $this->data[0]->getNuVaga(); ?></label>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="row-fluid">
                        <div class="span12">
                            <div class="span3">
                                <div class="controls controls-rows">
                                    <label class="control-label"><strong>Modalidade:</strong> <?php echo $this->data[0]->getSqModalidadeProfessor()->getSqModalidade()->getNoModalidade(); ?></label>
                                </div>
                            </div>
                            <div class="span3">
                                <div class="controls controls-rows">
                                    <label class="control-label"><strong>Dias:</strong> <?php echo $this->data[0]->getSqTurmaDia()->getDeDia(); ?></label>
                                </div>
                            </div>
                            <div class="span3">
                                <div class="controls controls-rows">
                                    <label class="control-label"><strong>Professor:</strong> <?php echo $this->data[0]->getSqModalidadeProfessor()->getSqPessoa()->getSqPessoa()->getNoPessoa(); ?></label>
                                </div>
                            </div>
                            <div class="span3">
                                <div class="controls controls-rows">
                                    <label class="control-label"><strong>Situação Turma:</strong> <?php echo $this->data[0]->getSqSituacaoTurma()->getNoSituacaoTurma(); ?></label>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="row-fluid">
                        <div class="span6">
                            <input type="hidden" name="nuVaga" id="nuVaga" value="<?php echo $this->data[0]->getNuVaga(); ?>" />
                            <input type="hidden" name="sqTurma" id="sqTurma" value="<?php echo $this->data[0]->getSqTurma(); ?>" />
                            <input type="hidden" name="sqSituacaoTurma" id="sqSituacaoTurma" value="<?php echo $this->data[0]->getSqSituacaoTurma()->getSqSituacaoTurma(); ?>" />
                            <table id="tabelaTurmas"
                                   class="table table-bordered table-striped">
                                <caption>
                                    <h3><strong>A Sortear</strong></h3>
                                </caption>
                                <thead>
                                    <tr>
                                        <th>Ordem</th>
                                        <th>Nome</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <?php
                                    $count = 1;
                                    foreach ($this->preMatriculas as $preMatricula):
                                        ?>
                                        <tr>
                                            <td>
                                                <?php
                                                if ($this->data[0]->getSqSituacaoTurma()->getSqSituacaoTurma() == Sisesporte\Constant\TipoSituacaoTurmaConstant::A_SER_SORTEADA):
                                                    ?>
                                                    <input type="checkbox" title="Prioridade" name="selPreMatricula[]" value="<?php echo $preMatricula->getSqPreMatricula() ?>">
                                                    <?php
                                                endif;
                                                echo $count++
                                                ?>
                                            </td>
                                            <td>
                                                <?php echo $preMatricula->getSqAluno()->getSqPessoa()->getNoPessoa() ?>
                                            </td>
                                        </tr>
                                        <?php
                                    endforeach;
                                    ?>
                                </tbody>
                            </table>
                        </div>
                        <div class="span6" id="resultadoSorteio">
                            <form action="/admin/sorteio/sortear" method="post" id="frmResultadoSorteio" enctype="" >
                                <table id="tabelaTurmas"
                                       class="table table-bordered table-striped">
                                    <caption>
                                        <h3><strong>Resultado Sorteio</strong></h3>
                                    </caption>
                                    <thead>
                                        <tr>
                                            <th>Ordem</th>
                                            <th>Nome</th>
                                        </tr>
                                    </thead>
                                    <tbody id="sorteados">
                                        <?php
                                        $i = 1;
                                        if($this->preSorteadas) {
                                            foreach ($this->preSorteadas as $sorteados):
                                                $cor = ($i <= $this->data[0]->getNuVaga()) ? "#BEF9B3" : "#F7AFB7";
                                                ?>
                                                <tr>
                                                    <td style="background-color:<?php echo $cor ?>"><?php echo $sorteados->getNuOrdem() ?></td>
                                                    <td style="background-color:<?php echo $cor ?>"><?php echo $sorteados->getSqAluno()->getSqPessoa()->getNoPessoa() ?></td>
                                                </tr>
                                                <?php
                                                $i++;
                                            endforeach;
                                        }
                                        ?>
                                    </tbody>
                                </table>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="/js/sisesporte-admin/sorteio/sorteio.js"></script>